Skip to content

CA-399669: Do not exit with error when IPMI readings aren't available #6261

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jan 31, 2025

Conversation

psafont
Copy link
Member

@psafont psafont commented Jan 29, 2025

This error made toolstack restarts fail.

Because not all drivers have ipmi available, exit gracefully instead.

Also try to extract the reason from the command's output and log it. This means that now functions that use Utils.exec_cmd now red the stderr of the command as well.

Fixes #6252

Copy link
Contributor

@last-genius last-genius left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems fairly fragile to rely on phrasing of error messages, but it's better than what we have right now.

This error made toolstack restarts fail.

Because not all drivers have ipmi available, exit gracefully instead.

Signed-off-by: Pau Ruiz Safont <pau.ruizsafont@cloud.com>
The -I argument is to select a device, unsure why open is passed to it instead,
but it doesn't seem to have any effect

Signed-off-by: Pau Ruiz Safont <pau.ruizsafont@cloud.com>
@psafont psafont force-pushed the private/paus/ipmissing branch from 774633f to d7a5c7e Compare January 29, 2025 11:36
When the IPMI devices are missing, this is printed in the error line:

$ /usr/bin/ipmitool -I open dcmi discover
Could not open device at /dev/ipmi0 or /dev/ipmi/0 or /dev/ipmidev/0: No such file or directory

Detect this situation so an appropriate warning can be printed.

This needed changes in the function that executes the command, to be able to
process stderr

Example output:
$ ./disco.exe
[debug] Forking command /usr/bin/ipmitool dcmi discover
[debug] Forked command /usr/bin/ipmitool dcmi discover
[ info] DCMI discover: Could not open device at /dev/ipmi0 or /dev/ipmi/0 or /dev/ipmidev/0: No such file or directory
[debug] Process 423018 exited normally with code 1
[ warn] IPMI DCMI power readings not available, stopping. Reason: IPMI devices are missing

Signed-off-by: Pau Ruiz Safont <pau.ruizsafont@cloud.com>
@psafont psafont force-pushed the private/paus/ipmissing branch from d7a5c7e to e24a5cc Compare January 29, 2025 11:42
On the DCMI daemon, ignore any kind of exception, rather than only end_of_line.
On exec_cmd, close the file descriptor even if exception are raised while
reading lines.

Signed-off-by: Pau Ruiz Safont <pau.ruizsafont@cloud.com>
@psafont
Copy link
Member Author

psafont commented Jan 30, 2025

I've rerun the binary with the new code in exec_cmd, works as expected

@psafont psafont added this pull request to the merge queue Jan 31, 2025
Merged via the queue into xapi-project:master with commit 6ca87f1 Jan 31, 2025
15 checks passed
@psafont psafont deleted the private/paus/ipmissing branch January 31, 2025 13:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

xcp-rrdd-dcmi.service fails when machine has no IPMI
3 participants